/*
 * GlobalData.h
 *
 *  Created on: 23-01-2012
 *      Author: Jarek
 */

#ifndef GLOBALDATA_H_
#define GLOBALDATA_H_

#include <android/log.h>
#include <math.h>
#include <assert.h>

#include "DeviceInfoManager.h"

#define  LOG_TAG    "ENGINE"

#define 	LOGI(...) (__android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__))
#define 	LOGW(...) (__android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__))
#define  	LOGE(...)  __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)

#include <GLES/gl.h>  // OpenGL ES header file
#include <GLES/glext.h> // OpenGL ES header file
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

#define SHADER_LOG_BUFFER_SIZE 	2048

#define DELETE(x)				{ if ((x) != NULL) { delete    (x); (x) = NULL; } }
#define DELETE_ARRAY(x)			{ if ((x) != NULL) { delete [] (x); (x) = NULL; } }

#define	M_PI		3.14159265358979323846	/* pi */

#define DEG2RAD(x)      			((x)*0.0174532925)
#define RAD2DEG(x)      			((x)*57.29578)
#define QUATERNION_NORMALIZE_EPS	0.00001

#define ABS(x)						( (x) > 0 ? (x) : -(x) )
#define FLOAT_EPS 					0.001
#define FLOAT_EQ(a, b)				(ABS((a) - (b))	< (FLOAT_EPS))

#define LERP(t, a, b) 				( (a) + (t) * ((b) - (a)) )
#define CLAMP(val, min, max)		{ if ((val) < (min)) { (val) = (min); } else if ((val) > (max)) { (val) = (max); } }


typedef unsigned int    uint;
typedef unsigned char	byte;
typedef unsigned char   uchar;

#define INSTANTIATE_VECTOR_TEMPLATE(x)	\
	template class x<int>;				\
	template class x<float>;			\
	template class x<double>;

#define INSTANTIATE_MATRIX_TEMPLATE(x)	\
	template class x<float>;			\
	template class x<double>;



#endif /* GLOBALDATA_H_ */
